//
//  SCRecorderTools+LLMetadata.m
//  live.ly
//
//  Created by bob on 16/7/14.
//  Copyright © 2016年 musical.ly. All rights reserved.
//

#import "SCRecorderTools+LLMetadata.h"


@implementation SCRecorderTools (LLMetadata)

static NSArray *nextMeta;

+ (void)setCurrentMetadata:(NSArray *)arr
{
    nextMeta = arr;
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"

+ (NSArray *)assetWriterMetadata
{
    NSMutableArray *arr = [@[] mutableCopy];
    if (nextMeta) {
        [arr addObjectsFromArray:nextMeta];
    }
    AVMutableMetadataItem *creationDate = [AVMutableMetadataItem new];
    creationDate.keySpace = AVMetadataKeySpaceCommon;
    creationDate.key = AVMetadataCommonKeyCreationDate;
    creationDate.value = [[NSDate date] toISO8601];

    AVMutableMetadataItem *software = [AVMutableMetadataItem new];
    software.keySpace = AVMetadataKeySpaceCommon;
    software.key = AVMetadataCommonKeySoftware;
    software.value = @"live.ly";

    [arr addObject:creationDate];
    [arr addObject:software];

    return [arr copy];
}

#pragma clang diagnostic pop


@end
